package com.aaa.proxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/8/19 9:23
 * @description：
 * @modified By：
 * @version:
 */
public class MyMethodInterceptorImpl  implements MethodInterceptor {
    LogUtil logUtil = new LogUtil();
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        //增强处理
        logUtil.log(method.getName());
        //执行目标对象的业务
        Object invokeSuper = proxy.invokeSuper(obj, args);
        return invokeSuper;
    }
}
